package pcsr.drivers.nxtDriver;

enum NXTActuatorRegulationMode {
	IDLE( 0 ),
	MOTORSPEED( 1 ),
	MOTOR_SYNC( 2 );
	
	private int regulationModeValue;
	
	private NXTActuatorRegulationMode( int value )
	{
		if(value < 0 || value > 2)
		{
			throw new IllegalArgumentException("NXTActuatorRegulationMode values between 0 and 2.");
		}
		regulationModeValue = value;
	}
	
	public int GetRegulationModeValue( )
	{
		return regulationModeValue;
	}
	
	public static NXTActuatorRegulationMode GetRegulationModeByValue( int regulationmodevalue )
	{
		switch (regulationmodevalue) 
		{
			case 0:
				return IDLE;
			case 1:
				return MOTORSPEED;
			case 2:
				return MOTOR_SYNC;
		}
		
		return null;
	}
}
